<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<%@ include file="../../common/jsp/sheetHeader.jsp" %>
<link rel="Stylesheet" type="text/css" href="/Mass_template/common/colpick/css/colpick.css" />
<script type="text/javascript" src="/Mass_template/common/colpick/js/colpick.js"></script>
<script>
	$(document).ready(function() {
		
		//sheet 초기화  
		createIBSheet2(document.getElementById("viewArea"),"mySheet","100%","400px");
		
		var cfg = {FrozenCol:3,FrozenColRight:1,SearchMode:smLazyLoad,Page:30};
		var headers = [
			{Text:"모델번호|평형|단가(A)|판매가(B)\nA * 1.03 / 100|현금구입가(C)\n A * 0.9 / 100|할부구입가(D)\nA * 0.93 / 100|현금부담액\nB-C|할부부담액\nB-D", Align:"Center"}
		];
		var info = {Sort:1,ColMove:1,ColResize:1,HeaderCheck:0};
		var cols = [
			{Type:"Text",Width:130},
			{Type:"Text",Width:100,ColMerge:0},
			{Type:"Int",Width:80,SaveName:"A", Align:"Right",ColMerge:0},
			{Type:"AutoSum",Width:85,SaveName:"B",Format:"#,##0.00",CalcLogic:"|A|*1.03/100", Align:"Right",ColMerge:0},
			{Type:"AutoSum",Width:85,SaveName:"C",Format:"#,##0.00",CalcLogic:"|A|*0.9/100", Align:"Right",ColMerge:0},
			{Type:"AutoSum",Width:85,SaveName:"D",Format:"#,##0.00",CalcLogic:"|A|*0.93/100", Align:"Right",ColMerge:0},
			{Type:"AutoAvg",Width:85,Format:"#,##0.00",CalcLogic:"|B|-|C|",ColMerge:1, Align:"Right",ColMerge:0},
			{Type:"AutoAvg",Width:85,Format:"#,##0.00",CalcLogic:"|B|-|D|", Align:"Right",ColMerge:0}
		];

		mySheet.SetConfig(cfg);
		mySheet.InitHeaders(headers,info);
		mySheet.InitColumns(cols);

		mySheet.FitColWidth();
		
		doAction("search");
	});
	
	function mySheet_OnMouseDown(Button, Shift, X, Y) {
		$('.GMSelection').scrollLeft(100);
		$('.GMPageFirst').scrollLeft(100);
	}
	
	function mySheet_OnMouseUp(Button, Shift, X, Y) {
		window.scrollTo(100,200);
	}
	
	function mySheet_OnMouseMove(Button, Shift, X, Y) {
		if (Button == 1) {
			$('.GMPageFirst').scrollLeft(100);
		}
	}
	
	function mySheet_OnHScroll(hpos, oldhpos, isLeft, isRight, section) {
		
	}
	
	/*Sheet 각종 처리*/
	function doAction(sAction) {
		
		switch(sAction) {
			case "search":		//조회
				mySheet.DoSearch("../data/sheet_data2.xml");
				break;
			case "subsum":
			    var info = [{StdCol:0, SumCols:"2|3|4|5", ShowCumulate:0,Sort:0,CaptionCol:0}];
			   	mySheet.ShowSubSum(info); 
			   	doAction('search');
		    break;
		}
	}
	
	
</script>
<title>틀고정/행고정 예제</title>
</head>
<body>
<div id="main">
	<%@ include file="../../common/jsp/sheetNavi.jsp" %>
	<div id="title">틀고정/행고정 예제</div>
	<div id="desc">
		컬럼 초기화 시 FrozenCol을 사용하여, 컬럼을 고정 시킬 수 있다.<br>
		FrozenCol은 좌측 고정컬럼의 수, FrozenColRight는 우측 고정컬럼의 수를 설정할 수 있다.
	</div>

	<div id="functionArea">
		<div>시트 생성시 열을 설정하는 부분에서 Cursor를 지정할 수 있다.</div>
		<div>var cfg = {<font color="#FF0000"><u>FrozenCol:3</u></font>,<font color="#FF0000"><u>FrozenColRight:1</u></font>,SearchMode:smLazyLoad,Page:30};<br>
		mySheet.SetConfig(cfg);<br>
		</div>
	</div>
	
	<div id="viewArea">
	</div>
</div>
</body>
</html>